import { execSync } from "child_process";
import os from "os";

// 检测操作系统
const platform = os.platform();

// 根据操作系统执行不同的命令
switch (platform) {
    case "win32": {
        runCommand("cd deploy && deploy.bat");
        break;
    }
    case "darwin": {
        runCommand("cd deploy && deploy.sh");
        break;
    }
    default: {
        runCommand("cd deploy && deploy.sh");

        console.error("不支持的操作系统");
    }
}

function runCommand(command) {
    try {
        // 执行命令并返回输出
        execSync(command, { stdio: "inherit" });
    } catch (error) {
        // 捕获并显示错误
        error && console.error("执行错误:", error);
    }
}
